package cn.rcth.base.mapper;

import cn.rcth.base.domain.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OrderMapper extends BaseMapper<Order> {
    int deleteByPrimaryKey(Long id);

    int insert(Order record);

    Order selectByPrimaryKey(Long id);

    List<Order> selectAll();

    int updateByPrimaryKey(Order record);

    /**
     * 查询用户所有的订单
     * @param userId
     * @return
     */
    List<Order> getUserOrder(@Param("userId") Long userId, @Param("orderStatus") Integer orderStatus);

    /**
     * 根据订单号查询订单
     * @param sn
     * @return
     */
    Order selectOrderBySn(String sn);

    /**
     * 根据订单状态查询订单
     * @param statusAgo 状态
     * @return
     */
    List<Order> getOrderByOrderStatus(Integer statusAgo);

    /**
     * 根据状态查询条数
     * @param userId
     * @return
     */
    int selectNumByUnpaid(Long userId);

    int selectNumByPaid(Long userId);

    int selectNumByPendingReceipt(Long userId);
}